package com.orangecy.rulesubscribe.define;

import com.orangecy.common.bean.OrangeCyBean;
import lombok.*;

/**
 * @Author : orangeCy.奕
 * @Product : 猎豹养成产品源码
 * @Time : 2021/10/22
 * @Desc : 执行处理 记录规则的结果状态
 */
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class RuleActuatorDTO extends OrangeCyBean {
    private static final long serialVersionUID = 2404928830800037170L;
    /**
     * 规则code
     */
    private String ruleCode;

    /**
     * 规则name
     */
    private String ruleName;

    /**
     * 执行结果
     */
    private Boolean actuatorRes;

    /**
     * 执行结果 失败原因
     */
    private String actuatorMsg;

    public static RuleActuatorDTO ruleSuccess(String code, String name) {
        return RuleActuatorDTO.builder().ruleCode(code).ruleName(name).actuatorRes(true).build();
    }

    public static RuleActuatorDTO ruleFail(String code,String name,String errMsg) {
        return RuleActuatorDTO.builder().ruleCode(code).ruleName(name).actuatorRes(false).actuatorMsg(errMsg).build();
    }
}